package com.lsh.oms.core.utils;

import org.joda.time.DateTime;

import java.util.concurrent.TimeUnit;

public final class DateTimes {

    public static Integer withTime(int hour, int minute, int second) {
        return withTime(hour, minute, second, 0);
    }

    public static Integer withTime(int hour, int minute, int second, int millisecond) {
        return (int) TimeUnit.MILLISECONDS.toSeconds(new DateTime().withTime(hour, minute, second, millisecond).getMillis());
    }

    public static Integer seconds(DateTime dateTime) {
        return (int) TimeUnit.MILLISECONDS.toSeconds(dateTime.getMillis());
    }
}
